/** 
 *  @file       lcd_display.h
 *  @brief      项目程序头文件
 *  @author     Z B T   
 *  @version    
 *  @date       2016-01-18
 */
 
 /* Includes ------------------------------------------------------------------*/
#include "lcd_display.h"
#include "lcd1602.h"
#include "ds18b20.h"

/* Private function prototypes ------------------------------------------------*/

/* Private functions ---------------------------------------------------------*/

/* Public functions ---------------------------------------------------------*/
/**
 *  @brief  lcd1602显示ds18b20的温度值
 *  @param  None
 *  @return None
 */
void lcd_display_temperature()
{
    signed int value;
    unsigned int temperature_value[3];
    
    value = DS18B20_get_temperature();
    temperature_value[0] = value / 100;
    temperature_value[1] = value / 10 % 10;
    temperature_value[2] = value % 10;
    
    LCD1602_write_cmd(0x80);
    if (value > 0)
    {
        LCD1602_write_data('+');        /**< 温度值大于0 */
    }
    else
    {
        LCD1602_write_data('-');        /**< 温度值小于0 */
    }
    LCD1602_write_data('0' + temperature_value[0]);
    LCD1602_write_data('0' + temperature_value[1]);
    LCD1602_write_data('0' + temperature_value[2]);
    LCD1602_write_data('C');  
}